<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});

Route::group(['namespace'=>'Api','prefix'=>'userReg'],function (){
    //登录、注销
    Route::get('index','UserRegController@index');
    Route::post('sendSms','UserRegController@sendSms');
    Route::post('login','UserRegController@login');
    Route::any('cate','UserRegController@cate');
    Route::any('search','UserRegController@searchGoods');
});

Route::group(['namespace'=>'Api','prefix'=>'cate'],function (){
    //所有分类首页
    Route::post('index','CateController@index');
    Route::post('list','CateController@getCateList');
    Route::post('getCateProList','CateController@getCateProList');
    Route::post('detail','CateController@proDetail');
});
Route::group(['namespace'=>'Api','prefix'=>'mine'],function (){
    Route::post('feedback','MineController@feedback');//意见反馈
    Route::post('add_collect','MineController@addCollect');//添加收藏
    Route::post('remove_collect','MineController@removeCollect');//取消收藏
    Route::post('collects','MineController@collects');//获取我的收藏
    Route::post('set_avatar','MineController@setAvatar');//设置头像

    Route::post('set_search_history','MineController@setSearchHistory');//设置搜索历史
});
Route::group(['namespace'=>'Api','prefix'=>'index'],function (){
    Route::post('advertising','IndexController@advertising');//开屏广告
    Route::post('index','IndexController@index');//首页
    Route::post('get_more','IndexController@getMore');//加载更多商品
    Route::post('get_activity_goods','IndexController@getActivityGoods');//获取活动商品
    Route::post('get_more_rage_goods','IndexController@getMoreRageGoods');//获取更多爆款商品

    Route::post('get_goods_by_cate_id','IndexController@getGoodsByCateId');//获取二级分类商品
    Route::post('get_goods_by_cate_pid','IndexController@getGoodsByCatePid');//获取一级分类商品

    Route::post('get_search_words','IndexController@getSearchWords');//获取搜索词

    Route::post('get_recommend_words','IndexController@getRecommendWords');//获取搜索推荐

    Route::post('search_goods','IndexController@searchGoods');//搜索商品

});

Route::group(['namespace'=>'Api','prefix'=>'file'],function (){
    Route::post('upload_image','FileController@uploadImage');//上传头像
});